<?php 
	class Highlights_Menu_Walker extends Walker {
        var $tree_type = array( 'post_type', 'taxonomy', 'custom' );
        var $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id' );

        /**
         * @param string $output Passed by reference. Used to append additional content.
         * @param int $depth Depth of page. Used for padding.
         */
        function start_lvl(&$output, $depth) {
//                $indent = str_repeat("\t", $depth);
//                $output .= "\n$indent<ul class=\"sub-menu\">\n";
        }

        /**
         * @param string $output Passed by reference. Used to append additional content.
         * @param int $depth Depth of page. Used for padding.
         */
        function end_lvl(&$output, $depth) {
//                $indent = str_repeat("\t", $depth);
//                $output .= "$indent</ul>\n";
        }

        /**
         * @param string $output Passed by reference. Used to append additional content.
         * @param object $item Menu item data object.
         * @param int $depth Depth of menu item. Used for padding.
         * @param int $current_page Menu item ID.
         * @param object $args
         */
        function start_el(&$output, $item, $depth, $args) {
			global $wp_query;
			
			$id = 'post-'.$item->ID;

			global $item_count;	$item_count++;
			$classes[] = 'entry-list-item';
			$classes[] = ($item_count % 2 == 0) ? 'even' : 'odd';
			$class_names = join( ' ', $classes );
			
			$output .= "<div id='$id' class='$class_names'>";
			
			$attributes  = 
				!empty($item->attr_title) ? ' title="'  . esc_attr($item->attr_title) .'"' : '';
			$attributes .= 
				!empty($item->target) ? ' target="' . esc_attr($item->target) .'"' : '';
			$attributes .= 
				!empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) .'"' : '';
			$attributes .= 
				!empty($item->url) ? ' href="' . esc_attr($item->url) .'"' : '';
			
			$title = apply_filters( 'the_title', $item->title, $item->ID );
			
			$edit_url = get_edit_post_link($item->object_id);
			if ( $edit_url != null ) {
				$edit_link = '(<a href="'.$edit_url.'">editar</a>)';
			}
			
			$item_output = "<h1 class='entry-title'>";
			$item_output .= "<a ".$attributes.">".$title."</a>";
			$item_output .= "<span class='edit'>".$edit_link."</span>";
			$item_output .= "</h1>\n"; 
			
			$thumb_id = get_post_thumbnail_id( $item->object_id );
			if ( $thumb_id != null ) {
				$thumb_src = wp_get_attachment_image_src( $thumb_id, 'full' );
				$item_output .= "<div class='entry-thumb'>\n";
				$item_output .= "<img src='$thumb_src[0]'/>";
				$item_output .= "</div>\n";
			}
			
			$item_output .= "<div class='entry-body'>\n";			
			$item_output .= "<p>".__get_post_excerpt( $item->object_id )."</p>";
			$item_output .= "<p class='more'><a $attributes>Leia mais...</a></p>";
			$item_output .= "</div>\n";
			
			$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
        }

        /**
         * @param string $output Passed by reference. Used to append additional content.
         * @param object $item Page data object. Not used.
         * @param int $depth Depth of page. Not Used.
         */
        function end_el(&$output, $item, $depth) {
                $output .= "</div>\n";
        }
	}

	$args = array(
		'theme_location' => 'highlights',
		'menu_id' => 'highs-list',
		'menu_class' => 'entry-list highs-list',
		'depth' => 1,
		'container' => false,
		'walker' => new Highlights_Menu_Walker(),
	);
	wp_nav_menu( $args ); 
?>